/**
 * Formulario para Criar um Projeto
 *
 * @this {UICreateProjectDialog}
 * @version
 */

function UICreateProjectDialog() {

    /**
     * Variaveis
     */
    var _oCreateProjectDialog = null;

    /**
     * Inicializa o objeto da classe
     */
    this.init = function() {

        // Dialog Criar Projeto
        this.initCreateProjectDialog();
    }

    /**
     * Funcoes
     */
    this.initCreateProjectDialog = function() {

        _oCreateProjectDialog = new YAHOO.widget.Dialog("createprojectdialog", {
            constraintoviewport : true,
            fixedcenter : true,
            modal: false
        });
        var handleSubmit = function() {

            var oLayoutProject = ModelInstance.getLayoutProject();
            oLayoutProject.createProject();

        };
        var myButtons = [ {
            text:"Criar",
            name:"createprojectbutton",
            handler:handleSubmit,
            isDefault:true
        } ];
        _oCreateProjectDialog.cfg.queueProperty("buttons", myButtons);
    }

    this.showCreateProjectDialog = function() {
        var oLayoutProject = ModelInstance.getLayoutProject();
        if(oLayoutProject.projectIsOpened()) {
            if(confirm(EAppInfoMessages.eSaveAndGainProjectCopy)) {
                oLayoutProject.saveAsProject();
            }
            oLayoutProject.closeProject();
        }
        _oCreateProjectDialog.render();
        _oCreateProjectDialog.show();
    }

    this.hideCreateProjectDialog = function() {
        _oCreateProjectDialog.hide();
    }

    /**
     * Chamada do inicializador da classe
     */
    this.init();
}

